package thread;

public class ThreadDemo{

    public static void main(String[] args) {
//        Thread t1 = new T1();
//        Thread t2 = new T2();
//        t1.start();
//        t2.start();

//        Runnable r1 = new R1();
//        Runnable r2 = new R2();
//        Thread t1 = new Thread(r1);
//        Thread t2 = new Thread(r2);
//        t1.start();
//        t2.start();


        Thread t1 = new Thread(()->{
            for (int i = 0; i < 55555; i++) {
                System.out.println("你是谁");
            }
        });
        Thread t2 = new Thread(()->{
            for (int i = 0; i < 55555; i++) {
                System.out.println("开门，查水表的");
            }
        });
        t1.start();
        t2.start();
    }
}
class T1 extends Thread{
    @Override
    public void run() {
        for (int i = 0; i < 100000; i++) {
            System.out.println("你是色");
        }
    }
}
class T2 extends Thread{
    @Override
    public void run() {
        for (int i = 0; i < 100000; i++) {
            System.out.println("开门，查水表的");
        }
    }
}

class R1 implements Runnable{
    @Override
    public void run() {
        for (int i = 0; i < 100000; i++) {
            System.out.println("你是色");
        }
    }
}

class R2 implements Runnable{
    @Override
    public void run() {
        for (int i = 0; i < 100000; i++) {
            System.out.println("开门，查水表的");
        }
    }
}